<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    
    <title>用户管理</title>
     <!-- 前端模板部分 -->
  	<script type="text/template"  id="teamList">
		<|  for(var i = 0; i<list.length;i++){
		       var item = list[i];
		|>
 
  		           <tr>
			          <th scope='row'><|=i+1 |></th>
			          <td> <|=item.type==1? '个人用户':(item.type==2? '公司用户':'') |> </td>
			          <td> <|=item.phone |> </td>
			          <td> <|=item.cityname |> </td>
			          <td> <|=item.createTime |></td>
			          <td> <|=item.remianSpacePercent |></td>
			          <td class='console-action'>
                      <|if(item.status == 0){|>
			             	<a  href=javascript:updateStatus(1,<|=item.id |>)>启用</a>
                            <a  href=javascript:void   class='action-active'>禁用</a>
			          <|}else{|>
                    	    <a  href=javascript:void class='action-active'>启用</a>
                            <a  href=javascript:updateStatus(0,<|=item.id |>)>禁用</a>
                      <|}|>
	                       <a href=after/user/approveFirm?task=view&id=<|=item.id|>>查看</a>
			          </td>
			       </tr>
 
		 <|}|>
 
	</script>
	  <!-- 页面结构结束 -->
  </head>
  
  <body class="console-body">
	    <include page="../common/common.jsp"></include>
        <jsp:include page="../common/console.jsp"></jsp:include>
  	
  	<div class="console-list">
  		<div class="console-listSolid">&nbsp;</div>
  		<div class="console-listContent">
	  		<div class="console-listHead clearfix">
				<form class="navbar-form navbar-left" role="search" method="get" action="after/user/user_list">
					<div class="form-group">
					 	<input type="text" name="phone" class="form-control" placeholder="手机号...">
					</div>
					<button type="submit" class="btn btn-default">搜索</button>
				</form>
	  		</div>
	  	
	  		<div class="console-listTable">
		  		<table class="table table-hover">
			      <thead>
			        <tr>
			          <th>编号</th>
			          <th>用户类型</th>
			          <th>手机号</th>
			          <th>所在地</th>
			          <th>注册时间</th>
			          <th>私有空间剩余</th>
			          <th>操作</th>
			        </tr>
			      </thead>
			      
			      <tbody id="container" >
			      
			      </tbody>
			      
			    </table>
			    
				<nav class="clearfix">
				
					<c:if test="${datas.total > 0}">
						<jsp:include page="/jsp/pager.jsp">
							<jsp:param value="${datas.total}" name="totalRecord"/>
							<jsp:param value="after/user/user_list" name="url"/>
						</jsp:include>
					</c:if>

				</nav>
		    </div>
  		</div>
  	</div><!-- console-list -->
    
  </body>
 <script type="text/javascript">
  
 
    window.onload = function(){
	
         render(data);
	}
	
   function updateStatus(status,id){
    	  
    	  jConfirm('确定要'+(status==1? '启':'禁')+'用吗?', '操作确认', function(r) {
    	  
	    	     if(r){
	    	     	  $.ajax({
					     type: 'post',
					     url: 'after/user/updateStatus', 
						 data:  {"status":status,"id":id},
						 dataType: 'json',
						 success: function(data) {  
			                if(data.result){
			                    reloadData();
			                }else{
			                	jAlert(data.msg,'提示');
			                }
		
			            }
						
					 });
	    	     }

		  });

      
   }
 
 </script>
</html>
